﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace DICOMViewer.Model
{
    public class Requisition
    {
        [EditorBrowsable( EditorBrowsableState.Never)]
        [JsonProperty(PropertyName = "uuid")]
        public string uuid { get; set; }
        [DisplayName("申请单号"), ReadOnly(true)]
        [JsonProperty(PropertyName = "orderNumber")]
        public string OrderNumber { get; set; }
        [DisplayName("提交人"), ReadOnly(true)]
        [JsonProperty(PropertyName = "userName")]
        public string UserName { get; set; }

        [DisplayName("病人姓名"), ReadOnly(true)]
        [JsonProperty(PropertyName = "patientName")]
        public string PatientName { get; set; }

        [DisplayName("申请单状态"), ReadOnly(true)]
        [JsonProperty(PropertyName = "dataStatus")]
        public int dataStatus { get; set; }

        public string DataStatus
        {
            get
            {
                switch (dataStatus)
                {
                    case 0:
                        return "初始化";
                    case 1:
                        return "已上传";
                    case 2:
                        return "已审核";
                    case 3:
                        return "已完成";
                    default:
                        return string.Empty;
                }
            }
        }

        [DisplayName("医生姓名"), ReadOnly(true)]
        [JsonProperty(PropertyName = "doctorName")]
        public string DoctorName { get; set; }

        [DisplayName("病人电话"), ReadOnly(true)]
        [JsonProperty(PropertyName = "patientPhone")]
        public string PatientPhone { get; set; }

        [EditorBrowsable(EditorBrowsableState.Never)]
        [JsonProperty(PropertyName = "deliverytime")]
        public  long deliverytime { set; get; }
        [DisplayName("订单生成时间"), ReadOnly(true)]
        public string DeliveryTime
        {
            get
            {
                if (deliverytime == 0)
                {
                    return string.Empty;
                }
                else
                {
                    System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
                    // 当地时区
                    DateTime dt = startTime.AddMilliseconds(deliverytime*1000);
                    return dt.ToLocalTime().ToString(); //转为本地时区  
                }
            }
        }
        [EditorBrowsable(EditorBrowsableState.Never)]
        [JsonProperty(PropertyName = "addDicomTime")]
        public int addDicomTime { set; get; }
        [DisplayName("数据上传时间"), ReadOnly(true)]
        public string AddDicomTime
        {
            get
            {
                if (addDicomTime ==0)
                {
                    return string.Empty;
                }
                else
                {
                    System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
                    DateTime dt = startTime.AddMilliseconds((long)addDicomTime * 1000);
                    return dt.ToLocalTime().ToString();//转为本地时区  
//                    return addDicomTime.ToString();
                }

            }
        }

    }
}
